Using Common JavaScript Functions by Van Nguyen

Using Common JavaScript Functions by Van Nguyen

Author:Van Nguyen
Language: eng
Format: azw3
Published: 2017-08-01T07:00:00+00:00


</body>

</html>

» Output

2

□ isArray

check whether an object is an array

» Syntax

Array.isArray(obj)

» Parameters

† obj: Required, the object to be tested

» Sample Code

<!DOCTYPE html>

<html>

<body>

<p>Click the button to check if "fruits" is an array.</p>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>

function myFunction() {

var fruits = ["Banana", "Orange", "Apple", "Mango"];

var x = document.getElementById("demo");

x.innerHTML = Array.isArray(fruits);

}

</script>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.